 {include file="public/header" /}
 {load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style type="text/css">
#des,#des input{ width: 40px;text-align:center;}
#id{ width: 78px; }
.bs-checkbox{ width: 36px; height: 40px }
.fixed-table-toolbar .columns,.fixed-table-toolbar .search{margin-left:0px; margin-top: 0px }
#title span{ float: right; margin-left: 3.333px;}
</style>
 <body class="gray-bg">
 <div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
        {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="">
                            <div class="pull-left search">
                                <div class="columns columns-right btn-group pull-left">
                                    <select class="form-control" name="search_typeid">
                                        <option value="">所有栏目</option>
                                        {php}
                                        if(input('?param.search_typeid')){
                                            $typeidname=input('param.search_typeid');
                                        }else{
                                            $typeidname='';
                                        }
                                        {/php}
                                        {$typeidname}
                                        {volist name='typeid' id='v'} 
                                            <option value="{$v.id}" {eq name="v.id" value="$typeidname" }selected{/eq}>{:str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $v['depth'])}{gt name="$v['depth']" value="0"}┠&nbsp;&nbsp;{/gt}{$v.title}</option>
                                        {/volist}
                                    </select>
                                </div>
{php}
if(input('?param.search_name')){
{/php} 
<div class="pull-right search">
    <a class="btn btn-w-m btn-link" href="{:url('article/index')}">返回文章列表</a>
</div>{php}
}elseif(input('?param.typeid')){
{/php}
{php}
{/php} 
<div class="pull-right search">
    <a class="btn btn-w-m btn-link" href="{:url('typeid/index')}">返回栏目管理</a>
</div><div class="pull-right search">
    <a class="btn btn-w-m btn-link" href="{:url('article/index')}">返回文章列表</a>
</div>
{php}
}
{/php}
{php}
if(input('?param.flags')){
{/php} 
<div class="pull-right search">
    <a class="btn btn-w-m btn-link" href="{:url('article/flags')}">返回自定义属性</a>
</div>{php}
}
{/php}
                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" id="filter" type="text"
{php}
if(input('?param.search_name')){
            if(input('param.search_name')){
               echo "value='".input('search_name')."'";
            } 

        }
{/php}
                                     name="search_name" placeholder="输入文章标题搜索">
                                </div>
                                

                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                        <table data-toggle="table">
                            <thead>
                                <tr>
                                   <th class="bs-checkbox"><input type="checkbox" id="delidAll"></th>
                                    <th data-align="center">排序</th>
                                    <th data-align="center">id</th>
                                    <th>栏目分类</th>
                                    <th>文章标题</th>
                                    <th>访问次数</th>
                                    <th>更新时间</th>
                             
                                    <th>管理</th>
                                </tr>
                            </thead> 
                            <tbody id="form">
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td id="delid" ><input name="delAll[]" type="checkbox" value="{$v.id}"></td>
                                    <td id="des"><input type="text" style="border:1px solid #e5e6e7" name="des[{$v.id}]" value="{$v.des}"></td>
                                    <td id="id">{$v.id}</td>
                                    <td><a href="{:url('article/index',['typeid'=>$v['tid']])}">{$v.typename}</a></td>
                                    <td id="title">
                                    {:_substr($v.title)}
                                    {notempty name="v.url"} 
                                        <span class="label label-danger">跳</span>
                                    {/notempty}
                                    {notempty name="v.flags"}
                                        <span class="label label-primary">{:_flags($v['flags'])}</span>
                                    {/notempty}
                                    {notempty name="v.image"}
                                        <span class="label label-primary">图</span>
                                    {/notempty}
                                    {notempty name="v.uid"}
                                        <span class="label label-primary">稿</span>
                                    {/notempty}

                                    </td>
                                    <td>{$v.click}</td>
                                    <td> 
                                        <span {php}if(date('Ymd')==date('Ymd',$v['update_time']))echo 'style="color: #ed5565"';{/php}>{$v.update_time|date='Y-m-d H:i:s',###}</span>
                                    </td>
                           
                                    <td>
                                        <div class="btn-group">
                                            <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">操作 <span class="caret"></span>
                                            </div>
                                            <ul class="dropdown-menu">
                                                <li><a onclick="add('{:url('add',['id'=>$v['id'],'mychannel'=>$v['mychannel'],'url'=>-1])}')">修改</a>
                                                </li>
                                                <li class="divider"></li>
                                                <li><a onclick="del({$v.id})">删除</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                            </tbody>
                        </table>
                        </form>
                    </div>
                </div>  
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-6">
                    <button type="button" class="btn btn-outline btn-default" id="desAll">
                        更新排序
                    </button>
                    <button type="button" class="btn btn-outline btn-default" id="delAll">
                        批量删除
                    </button>
                </div>
                <div class="col-sm-6 pages">{$page}</div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
$(document).ready(function(){
    $('#desAll').click(function(){
        var des=$(".form-horizontal").serialize();
        ajaxFun("post",'{:url('article/desAll')}',des,'json',function(ret){
            if(ret){
                if(ret.ret){
                    self.location.reload();
                }else{
                    layer.msg(ret.err)
                }
            }else{
                swal_msg("错误",ret,"error");
            }
        })
    })
    $('#delAll').click(function(){
        var delAll=$(".form-horizontal").serialize();
        swal_delAll(delAll,"{:url('article/delAll')}","1")
        // ajaxFun("post",'{:url('article/delAll')}',delAll,'json',function(ret){
        //     if(ret){
        //         if(ret.ret){
        //             layer.msg(ret.ret)
        //         }else{
        //             layer.msg(ret.err)
        //         }
        //     }else{
        //         swal_msg("错误",ret,"error");
        //     }
        // })
    })
    $('#delidAll').click(function(){
        $('input[type=checkbox]').each(function(){
            var self=$(this);
            if(!self.prop('checked')){
                self.prop('checked',true);
            }else{
                self.prop('checked',false);
            }
        });
    })
    
});
function del(id){
    swal_del(id,"{:url('del')}")
}
 
</script>
 <SCRIPT Language=VBScript><!--

//--></SCRIPT>